<html>
<head>
<title>Common modules</title>
</head>
<body>


<h2>Common modules</h2>
<p>Version 0.1</p>
<p>As the sytem is fully configurable you cannot rely on any prticular module 
being loaded. However in an attempt to standardise things,&nbsp;most systems 
should&nbsp;include some or all of the following. Modules should export at least the 
given variables. All should be floating point.</p>
<h3><B><a name="AHRS"></a>AHRS</B></h3>
<ul>
    <li>AHRS.Pitch</li>
    <li>AHRS.Roll</li>
    <li>AHRS.Yaw</li>
    <p>Attitude and Heading Reference System. This gives the craft's attitude 
    in space. It may be based on an IMU, thermopiles or other trickery. All 
    but the very&nbsp;simplest systems should have an AHRS. Angles should be 
    in radians. 0 pitch, 0 roll is level. 0 yaw is ideally north but this may 
    be prone to drift, depending on AHRS implementation. +pitch is nose up. 
    +roll is roll right. +yaw is clockwise as seen 
    from the top.</p>
</ul>
<h3>INS</h3>
<ul>
    <li>INS.Heading</li>
    
    <li>INS.Latitude</li>
    <li>INS.Longitude</li>
    <p>Instrument Navigation System. Heading and optionally 
    position data, probably based on GPS or integration of AHRS and pitot tube 
    data. This module only makes sense for craft with&nbsp;navigation systems. 
    Latitude and Longitude are in decimal degrees WGS84 (GPS standard).&nbsp;Heading 
    is in radians and 0 is north. Note heading is not the same as 'AHRS.Yaw'. 
    The craft may be crabbing sideways or even going backwards.</p>
</ul>
<h3>Gyro</h3>
<ul>
    <li>Gyro.Pitch</li>
    <li>Gyro.Roll</li>
    <li>Gyro.Yaw</li>
    <p>Rate of angular velocity, preferably&nbsp;in radians/sec</p>
</ul>
<h3>Accel</h3>
<ul>
    <li>Accel.X</li>
    <li>Accel.Y</li>
    <li>Accel.Z</li>
    <p>Rate of acceleration, preferably in Gs. X+ is accelerating forwards, 
    Y+ is accelerating right, Z+ is accelerating down. See <a href="http://en.wikipedia.org/wiki/Flight_dynamics">this 
    article</a> for the relation between pitch, roll, yaw and X,Y,Z.</p>
</ul>
<h3>Altimeter</h3>
<ul>
    <li>Altimeter.Altitude</li>
    <p>Altitude, preferably in feet. FIXME: We Are feet the best units to use?</p>
</ul>
<h3>Compass</h3>
<ul>
    <li>Compass.Heading</li>
    <p>Compass heading. Preferably in radians. 0&nbsp;is north.</p>
</ul>
<h3>Airspeed</h3>
<ul>
    <li>Airspeed.Speed</li>
    <p>Probably a pitot tube. Speed in units/sec. FIXME: we need to define units 
    here.&nbsp;metres? feet?</p>
</ul>
<h3>Servo</h3>
<ul>
    <li>Servo.1</li>
    <li>Servo.2</li>
    <li>....</li>
    <p>Standard servo outputs. 0 is center, 1 is full +ve, -1 is full -ve. Note: 
    be careful when implementing this as names must be static. You can't just 
    use sprintf(&quot;Servo.%i&quot;,n) &nbsp;to generate the name.</p>
</ul>
<h3>FastServo.Servo</h3>
<ul>
    <li>FastServo.1</li>
    <li>FastServo.2</li>
    <li>...</li>
    <p>High speed PWM or I2C&nbsp;for digital servos and ESCs. Mainly used &nbsp;for 
    multi rotor craft and helicopter tail rotors.</p>
</ul>
<h3>Receiver</h3>
<ul>
    <li>Receiver.Throttle</li>
    <li>Receiver.Rudder</li>
    <li>Receiver.Elevator</li>
    <li>Receiver.Aileron</li>
    <li>Receiver.Aux.1</li>
    <li>Receiver.Aux.2</li>
    <li>....</li>
    <li>Receiver.Switch.1</li>
    <li>Receiver.Switch.2</li>
    <li>....</li>
    <p>Receiver inputs. Could be separate PWM inputs, one PPM input or some 
    other form of telemetry. Range is -1 to +1 with 0 as center. Rudder&nbsp;is 
    yaw, elevator&nbsp;is pitch and aileron is roll. See <a href="#AHRS">AHRS</a> for the directions.&nbsp;FIXME: 
    Should throttle range be 0 to 1?<br>Switches, if implemented should be 8 
    bit, normally 3 position (0,1,2). If the switch is 2 position, use 0,2.</p>
</ul>
<h3>&nbsp;FlightControl</h3>
<ul>
    <li>FlightControl.Pitch</li>
    <li>FlightControl.Roll</li>
    <li>FlightControl.Yaw</li>
    <li>FlightControl.Throttle</li>
    <p>Calculate the needed changes in attitude based on receiver data, navigation 
    directions, current craft attitude etc. Pitch, roll and yaw are relative. See <a href="Common%20modules.htm#AHRS">AHRS</a> for the directions. Throttle is absolute. Relative value are 
    in the range -1 to +1, throttle is in the range 0 to 1.</p>
</ul>
<h3>Kinematics</h3>
<ul>
    <p>Calculate the servo/ motor outputs needed to convert FlightControl's 
    commands&nbsp;to the correct motion. This module has no standard variables 
    as it is very dependent on the craft being controlled. The simplest implementation 
    would be a 4 channel plane where pitch, roll, yaw would generally be directly 
    connected to elevators, ailerons and rudder.</p>
</ul>
</body>
</html>